//
//  ViewController.m
//  05-scrollView相册
//
//  Created by 402030900@qq.com on 16/7/20.
//  Copyright © 2016年 402030900@qq.com. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()<UIScrollViewDelegate>

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIScrollView * scrollView = [[UIScrollView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    scrollView.backgroundColor = [UIColor yellowColor];
    [self.view addSubview:scrollView];
    scrollView.contentSize = CGSizeMake(375 * 2, 667);
//    scrollView.contentOffset = CGPointMake(375, 0);
    scrollView.pagingEnabled = YES;
    scrollView.bounces = NO;//---------------

    NSArray * picArr = @[@"03",@"04"];
  
    for (int i = 0; i < picArr.count; i ++) {
    UIScrollView * smallScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(375 * i, 0, 375, 667)];
        smallScrollView.delegate = self;
        smallScrollView.maximumZoomScale = 2;
        smallScrollView.minimumZoomScale = 0.5;
    UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 375 , 667)];
        imageView.image = [UIImage imageNamed:picArr[i]];
        [smallScrollView addSubview:imageView];
        [scrollView addSubview:smallScrollView];
        
    }
    // Do any additional setup after loading the view, typically from a nib.
}

-(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{

    NSLog(@"%@",scrollView.subviews.firstObject);
    return [scrollView.subviews firstObject];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
